package com.hc.dao;

import com.hc.bean.Type;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TypeDao {
    /*查询所有类型*/
    @Select("select * from type")
    public List<Type> getTypeList();

    /*添加商品类型*/
    @Insert("insert into type(name) values(#{name})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public Integer addType(Type type);

    /*修改商品类型*/
    @Update("update type set name=#{name} where id=#{id}")
    public int updateTye(Type type);

    /*根据id查询type*/
    @Select("select * from type where id=#{id}")
    public Type getTypeById(Integer id);
}
